package com.example.mobile2021606144ywr0506;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class ShowDataActivity extends AppCompatActivity {

    private TextView tvShowTitle;
    private TextView tvShowUserName;
    private TextView tvShowPass;
    private TextView tvShowDatasup;
    private Button btnShouDataselect;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_data);
        initView();
        Intent intent = getIntent();
        tvShowUserName.setText(intent.getStringExtra("userName"));
        Bundle bundle = intent.getExtras();
        tvShowPass.setText(bundle.getString("passWord"));
        btnShouDataselect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1=new Intent(ShowDataActivity.this,SupplierActivity.class);
                startActivityForResult(intent1,1);

            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode==1&&resultCode==RESULT_OK){
            String sipplieraName=data.getStringExtra("supplier");
            tvShowDatasup.setText(sipplieraName);
        }
    }

    private void initView() {
        tvShowTitle = (TextView) findViewById(R.id.tv_show_title);
        tvShowUserName = (TextView) findViewById(R.id.tv_show_UserName);
        tvShowPass = (TextView) findViewById(R.id.tv_show_Pass);
        tvShowDatasup = (TextView) findViewById(R.id.tv_show_Datasup);
        btnShouDataselect = (Button) findViewById(R.id.btn_shou_Dataselect);
    }
}